<template>
	<view style="width: 100%;height: 100%;position: relative;">
		<!-- #ifdef APP-PLUS -->
		<Hearder :name="'我的团队'"></Hearder>
		<!-- #endif -->
		<view v-if="JSON.stringify(info) !='{}'" style="padding-bottom: 110rpx;">
			<view class="v_two">
				<u-transition :show="show1">
					<view class="v_seven">
						<view class="v_eight" @click="goPage('direct')">
							<view class="cont_center">
								<u-transition :show="show1">
									<image class="gt_img" src="/static/images/team1.png"></image>
								</u-transition>
							</view>
							<view>团队管理</view>
						</view>
						<view class="v_eight" @click="goPage('moneys')">
							<view class="cont_center">
								<u-transition :show="show1">
									<image class="gt_img" src="/static/images/zj.png"></image>
								</u-transition>
							</view>
							<view>资金明细</view>
						</view>
						<view class="v_eight" @click="goPage('friends')">
							<view class="cont_center">
								<u-transition :show="show1">
									<image class="gt_img" src="/static/images/hymx.png"></image>
								</u-transition>
							</view>
							<view>好友明细</view>
						</view>
						<view class="v_eight" @click="goPage('order')">
							<view class="cont_center">
								<u-transition :show="show1">
									<image class="gt_img" src="/static/images/order.png"></image>
								</u-transition>
							</view>
							<view>订单明细</view>
						</view>
					</view>
				</u-transition>
			</view>
			<view class="f_one">
				<view class="f_two">
					<view style="color: #FF4B46;">{{info.team.total_team_num}}</view>
					<view>总团队</view>
				</view>
				<view class="f_two">
					<view>{{info.team.valid_team_num}}</view>
					<view>有效团队</view>
				</view>
				<view class="f_two">
					<view>{{info.team.drive_team_num}}</view>
					<view>直推团队</view>
				</view>
				<view class="f_two">
					<view>{{info.team.under_team_num}}</view>
					<view>伞下团队</view>
				</view>
			</view>
			<view class="navbar clearfix">
				<view class="item">
					<view>交易金额</view>
					<view class="changecolor">{{info.order.total_order_price}}</view>
				</view>
				<view class="item">
					<view>手续费总合</view>
					<view class="changecolor">{{info.order.total_consignment_servicefee}}</view>
				</view>
				<view class="item">
					<view>交易订单</view>
					<view>{{info.order.total_order_num}}</view>
				</view>
				<view class="item">
					<view>当日业绩</view>
					<view>{{info.order.child_order_price}}</view>
				</view>
			</view>
			<view class="f_three">
				<view class="bigtitle">
					<view class="f_four">
						<image src="/static/images/788.png"></image>
						团队用户统计
					</view>
					<view class="d_eight" @click="showit(1)">
						<view>{{title}}</view>
						<view></view>
					</view>
				</view>
				<view class="f_five">
					<view class="f_six gun">
						<view style="color: #FF4A45;">{{info.statistics.register_num}}</view>
						<view>注册人数</view>
					</view>
					<view class="f_six gun">
						<view>{{info.statistics.perfect_num}}</view>
						<view>信息完善人数</view>
					</view>
					<view class="f_six">
						<view>{{info.statistics.activate_num}}</view>
						<view>激活人数</view>
					</view>
				</view>
				<view class="t_none" :style="{display: `${show}`}">
					<view class="pan bb" @click="Changes(1,1)">今天</view>
					<view class="pan bb" @click="Changes(2,1)">七日内</view>
					<view class="pan" @click="Changes(3,1)">30日内</view>
				</view>
			</view>

			<view class="r_one">
				<view class="bigtitle">
					<view class="f_four">
						<image src="/static/images/789.png"></image>
						活跃会员
					</view>
					<view class="d_eight" @click="showit(2)">
						<view>{{title2}}</view>
						<view></view>
					</view>
				</view>
				<view class="r_three" :style="index==0?'margin-top:14rpx;':''" v-for="(item,index) in info.list"
					:key="item.member_id">
					<view class="r_four">
						<view class="r_five">
							<view>
								<image class="five_img" :src="item.avatarUrl"></image>
							</view>
							<view>{{item.nickName}}<text>({{item.message}})</text></view>
						</view>
						<view class="r_six">{{item.mobile}}</view>
					</view>
					<view class="r_seven">
						<view class="r_eight wid300">直推人数:{{item.drive_num}}人</view>
						<view class="r_eight">会员级别:{{item.identity_name}}</view>
						<view class="r_eight wid300">累计收益:{{item.total_earnings}}元</view>
						<view class="r_eight">7日内收益:{{item.week_earnings}}元</view>
					</view>
					<view class="r_nine">
						<view class="r_nine_two" @click="goPage('charge?member_id='+item.member_id)">代充</view>
						<view class="r_nine_two" @click="goPage('direct?member_id='+item.member_id)">团队管理</view>
						<view class="r_nine_two" @click="goPage('mydetail?member_id='+item.member_id)">个人详情</view>
					</view>
				</view>
				<view class="t_none" :style="{display: `${shows}`}">
					<view class="pan bb" @click="Changes(1,2)">今天</view>
					<view class="pan bb" @click="Changes(2,2)">七日内</view>
					<view class="pan" @click="Changes(3,2)">30日内</view>
				</view>
			</view>
		</view>
		<shopro-login-modal :showLogin="showLogin" @loginhidden="loginhidden"></shopro-login-modal>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				listData: [],
				page: 1,
				showAll: false,
				loadStatus: 'more',
				showNoList: false,
				number_statistics: 2,
				title: '七日内',
				title2: '七日内',
				info: {},
				show: 'none',
				shows: 'none',
				active_number: 2,
				show1: true,
				showLogin: false
			}
		},
		onShow() {
			this.getData()
		},
		// onReachBottom() {
		// 	//uniapp 监听下拉加载生命周期
		// 	if (this.loadStatus == 'noMore') return;
		// 	this.page++;
		// 	this.loadStatus = 'loading';
		// 	this.getData();
		// },
		methods: {
			Changes(e, t) {
				if (t == 1) {
					this.number_statistics = e;
					if (e == 2) {
						this.title = '七日内'
					} else if (e == 1) {
						this.title = '今日'
					} else {
						this.title = '本月'
					}
				} else if (t == 2) {
					this.active_number = e;
					if (e == 2) {
						this.title2 = '七日内'
					} else if (e == 1) {
						this.title2 = '今日'
					} else {
						this.title2 = '本月'
					}
				}
				this.listData = [];
				this.page = 1;
				this.loadStatus = 'more';
				this.getData();
			},
			//获取福利中心展示信息
			getData() {
				this.request('/team/getTeamInfo', {
					number_statistics: this.number_statistics,
					active_number: this.active_number
				}).then(res => {
					if (res.data.code == -500) {
						this.showLogin = true
					}
					this.show = 'none';
					this.shows = 'none';
					if (res.data.code == 1) {
						this.info = res.data.data
					}
				})
			},
			back() {
				uni.navigateBack()
			},
			loginhidden(data) {
				this.showLogin = data
			},
			goPage(url) {
				uni.navigateTo({
					url: url
				})
			},
			showit(e) {
				if (e == 1) {
					if (this.show == 'none') {
						this.show = 'block'
					} else {
						this.show = 'none'
					}
				} else if (e == 2) {
					if (this.shows == 'none') {
						this.shows = 'block'
					} else {
						this.shows = 'none'
					}
				} else {
					this.show = 'none'
					this.shows = 'none'
				}
			}
		}
	}
</script>

<style lang="scss">
	.wid300 {
		width: 300rpx;
	}

	.gthdd {
		width: 10rpx;
		height: 40rpx;
		background-color: #ffaa00;
		position: absolute;
		top: 25rpx;
		left: 0rpx;
	}

	.r_one {
		position: relative;
		margin: 20rpx 3%;
		background: #FFF7F7;
		padding: 10rpx 20rpx 20rpx;
		border-radius: 10rpx;

		.bigtitle {
			border-bottom: none;

			.f_four {
				padding-left: 0;
			}

			.d_eight {
				margin-right: 0;
			}
		}

		.r_three {
			margin-top: 20rpx;
			background-color: white;
			border-radius: 10rpx;

			.r_nine {
				display: flex;
				justify-content: flex-end;
				padding: 20rpx;

				.r_nine_two {
					width: 140rpx;
					height: 60rpx;
					line-height: 60rpx;
					text-align: center;
					color: white;
					font-size: 24rpx;
					background: #1D9AF6;
					border-radius: 10rpx;
					margin-left: 20rpx;

					&:nth-of-type(2) {
						background: #FDA82E;
					}

					&:nth-of-type(3) {
						background: linear-gradient(to top, #F63C3C, #FF5A4E);
					}
				}
			}

			.r_seven {
				margin-top: 24rpx;
				display: flex;
				justify-content: space-between;
				flex-wrap: wrap;
				border-bottom: 1rpx solid #f8f8f8;
				padding: 0 20rpx;

				.r_eight {
					width: 50%;
					margin-bottom: 24rpx;
					font-size: 24rpx;
					color: #000;
				}
			}

			.r_four {
				display: flex;
				justify-content: space-between;
				align-items: center;
				border-bottom: 1rpx solid #f8f8f8;
				height: 104rpx;
				padding: 0 20rpx;

				.r_six {
					font-size: 26rpx;
				}

				.r_five {
					display: flex;
					align-items: center;

					.five_img {
						width: 43rpx;
						height: 43rpx;
						margin-right: 20rpx;
						border-radius: 50%;
					}

					>view {
						&:nth-of-type(2) {
							font-size: 28rpx;

							text {
								color: #FF3A37;
							}
						}
					}
				}
			}
		}
	}

	.bb {
		border-bottom: 1rpx solid #f3f3f3;
	}

	.tgn {
		position: fixed;
		top: 0rpx;
		width: 100%;
		height: 100%;
		background-color: rgba($color: #000000, $alpha: 0.4);
	}

	.t_none {
		position: absolute;
		top: 100rpx;
		right: 30rpx;
		z-index: 20;
		width: 300rpx;
		background-color: white;
		border-radius: 10rpx;

		&::before {
			content: "";
			position: absolute;
			left: 65%;
			top: -10rpx;
			width: 20rpx;
			height: 20rpx;
			// border: 2rpx solid #ff7f00;
			transform: rotate(135deg);
			border-left: none;
			border-bottom: none;
			background: white;
		}

		.pan {
			height: 100rpx;
			text-align: center;
			line-height: 100rpx;
			font-size: 30rpx;

		}
	}

	.t_none {
		position: absolute;
		top: 100rpx;
		right: 30rpx;
		z-index: 20;
		width: 300rpx;
		background-color: white;
		border-radius: 10rpx;

		&::before {
			content: "";
			position: absolute;
			left: 65%;
			top: -10rpx;
			width: 20rpx;
			height: 20rpx;
			// border: 2rpx solid #ff7f00;
			transform: rotate(135deg);
			border-left: none;
			border-bottom: none;
			background: white;
		}

		.pan {
			height: 100rpx;
			text-align: center;
			line-height: 100rpx;
			font-size: 30rpx;

		}
	}

	.gun {
		padding-right: 60rpx;
		border-right: 1rpx solid #e8e8e8;
	}

	.f_four {
		font-size: 28rpx;
		font-weight: 600;
		border-bottom: 1rpx solid #eee;
		height: 80rpx;
		line-height: 80rpx;
		padding-left: 20rpx;

		image {
			width: 34rpx;
			height: 34rpx;
			margin: -4rpx 20rpx 0 0;
		}
	}

	.bigtitle {
		display: flex;
		justify-content: space-between;
		align-items: center;
		border-bottom: 1rpx solid #eee;

		.f_four {
			border-bottom: 0;
		}

		.d_eight {
			width: 150rpx;
			height: 50rpx;
			line-height: 50rpx;
			display: flex;
			justify-content: center;
			align-items: center;
			background: #E84A51;
			border-radius: 30rpx;
			margin-right: 20rpx;

			view {
				color: #fff;
				font-size: 28rpx;

				&:last-of-type {
					position: relative;
					top: 6rpx;
					content: "";
					display: inline-block;
					width: 0;
					height: 0;
					border-width: 4px;
					border-style: solid;
					border-color: #fff transparent transparent transparent;
					margin-left: 10rpx;
				}
			}
		}
	}

	.f_three {
		position: relative;
		margin: 20rpx 3%;
		background: #fff;
		border-radius: 10rpx;
		padding-bottom: 20rpx;

		.f_five {
			display: flex;
			justify-content: space-around;
			padding: 34rpx 0rpx 12rpx;

			.f_six {
				>view {
					text-align: center;

					&:first-of-type {
						font-weight: 600;
						margin-bottom: 10rpx;
					}

					&:last-of-type {
						font-size: 24rpx;
						color: #999;
					}
				}
			}
		}
	}

	.f_one {
		margin: -70rpx 24rpx 0rpx 24rpx;
		display: flex;
		justify-content: space-around;
		padding: 26rpx 0rpx;
		background-color: white;
		border-radius: 10rpx;

		.f_two {
			>view {
				&:first-of-type {
					font-weight: 600;
					margin-bottom: 12rpx;
					text-align: center;
				}

				&:last-of-type {
					font-size: 24rpx;
					text-align: center;
				}
			}
		}
	}

	.navbar {
		background: #fff;
		border-radius: 10rpx;
		padding: 30rpx 0;
		margin: 20rpx 4% 0;

		.item {
			position: relative;
			float: left;
			width: 25%;
			text-align: center;

			view {
				text-align: center;
				color: #333;

				&:first-of-type {
					font-size: 24rpx;
					margin-bottom: 16rpx;
				}
			}

			.changecolor {
				color: #F83706;
			}
		}
	}

	.v_seven {
		display: flex;
		justify-content: space-between;
		padding: 0rpx 24rpx;
		margin-top: 14rpx;

		.v_eight {
			text-align: center;
			.cont_center{
				display: flex;
				align-items: center;
				justify-content: center;
			}
			.gt_img {
				width: 70rpx;
				height: 70rpx;
				margin-bottom: 15rpx;
			}

			>view {
				&:last-of-type {
					font-size: 24rpx;
					color: white;
				}

				&:first-of-type {
					text-align: center;
				}
			}
		}
	}

	.v_two {
		padding: 30rpx 24rpx 100rpx 24rpx;
		background: linear-gradient(to top, #F63C3C, #FF5A4E);
	}

	page {
		background-color: #F5F5F5;
	}
</style>